package com.kasax.base;

import android.content.ContentResolver;
import android.content.Context;

import androidx.core.content.ContextCompat;

public class AppGlobal {
    private static Context sApplicationContext;

    // 初始化（通常在 Application.onCreate() 中调用）
    public static void init(Context context) {
        sApplicationContext = context.getApplicationContext();
    }

    // 获取全局 Context
    public static Context getContext() {
        return sApplicationContext;
    }

    // 权限检查
    public static int checkPermission(String permission) {
        return ContextCompat.checkSelfPermission(sApplicationContext, permission);
    }

    // 获取 ContentResolver
    public static ContentResolver getContentResolver() {
        return sApplicationContext.getContentResolver();
    }
}